In Dart, there are no keywords like public
, protected
, and private
. If an identifier starts with an
underscore (_), it’s private to its library. So every type starting with underscore(_T
) is considered private.
Public API of a library is designed to be used outside the library itself. And this API is supposed to be stable and not change often. Changes to
the Public API will most likely break the code using it. This is why it is highly recommended to follow some standard processes of deprecation and
prepare the users to the breaking change if the one is coming.
In case private types appear in public API, the users of the API are forced to depend on those private types too, which is highly discouraged. This
is why it is very important to decouple the public API from the implementation. Internal implementation is a subject to change often and it shouldn’t
affect the users of the public API.
To keep this decoupling in control, this rule reports if some private types leaked into public API.